package com.itheima.array;

import java.util.ArrayList;

public class ArrayListDemo03 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("柳岩");
        list.add("杨幂");
        list.add("马尔扎哈");
        list.add("迪丽热巴");
        list.add("马尔扎哈");
        System.out.println(list);
        list.remove("马尔扎哈");//只删除从0索引开始的第一个指定元素
        System.out.println(list);
        list.set(2,"热巴");
        System.out.println(list);
        System.out.println(list.get(0));
        //System.out.println(list.get(3)); 索引越界
        System.out.println("集合长度:" + list.size());
    }
}
